import instance from "../utils/http";
export const LoginServer = async (username: string, password: string) => {
    const url = '/api/auth/login'
    const body = { username, password };
    try {
        const data = await instance.post(url, body);
        return data;
    } catch (error) {
        console.error('Error updating item:', error);
        // 可以根据需要抛出错误或返回某种错误状态
        throw error;
    }
}

export const registerServer = async (username: string, password: string, nickname: string) => {
    const url = '/api/user/register'
    const body = { username, password, nickname };
    try {
        const data = await instance.post(url, body);
        return data;
    } catch (error) {
        console.error('Error updating item:', error);
        // 可以根据需要抛出错误或返回某种错误状态
        throw error;
    }
}
